<?php
header('content-type:text/html;charset=utf8');
$id = $_GET['id'];
$con = mysqli_connect("localhost","root","root","ikea");
$res = mysqli_query($con,"select * from sofa where id='$id'");
$row = mysqli_fetch_assoc($res);
if($row){
    $arr = [
        "meta" => [
            "status" => 2,
            "masg" => "数据获取成功"
        ],
        "data"=>$row
    ];
}else{
    $arr = [
        "meta" => [
            "status" => 1,
            "masg" => "数据获取失败"
        ],
        "data"=>null
    ];
}
echo json_encode($arr);